/**
 * 
 */
package com.dragon.modules.yuegou.client.wechat.response;

import com.dragon.common.exception.DragonException;
import com.dragon.modules.yuegou.enums.code.LiveCode;
import com.dragon.modules.yuegou.enums.code.LiveUtils;

import java.io.Serializable;

/**
 * @author 添加商品提审响应
 *
 */
public class GoodsAddResponse implements Serializable{
	private static final long serialVersionUID = -1576927995881834080L;

	//响应值
	private Integer errcode;
	
	//响应内容
	private String errmsg;
	
	//商品ID
	private String goodsId;
	
	//审核ID
	private String auditId;

	public Integer getErrcode() {
		return errcode;
	}

	public void setErrcode(Integer errcode) {
		this.errcode = errcode;
	}

	public String getErrmsg() {
		return errmsg;
	}

	public void setErrmsg(String errmsg) {
		this.errmsg = errmsg;
	}

	public String getGoodsId() {
		return goodsId;
	}

	public void setGoodsId(String goodsId) {
		this.goodsId = goodsId;
	}

	public String getAuditId() {
		return auditId;
	}

	public void setAuditId(String auditId) {
		this.auditId = auditId;
	}
	
	// 响应较验
	public void check() {
		if (null != errcode && errcode.intValue() != 0) {
			LiveCode liveCode = LiveUtils.getLiveCode(errcode);
			if (liveCode == null) {
				throw new DragonException(LiveCode.LIVE_ERROR.getCode(),String.format(LiveCode.LIVE_ERROR.getMessage(),errmsg));
			}else {
				throw new DragonException(liveCode);
			}

		}
	}
	
}
